package blog.entity;

import java.util.List;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;

@Entity
public class Department {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private long deptId;
    @Column(name = "name")
    private String deptName;
    
//    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="department")   //匹配自己在对方的实体属性
//    private List<Employee> ownEmployeeList;
    
    public Department() {
    }   
    
    public Department(String name) {
	this.deptName = name;
    }


    public long getDeptId() {
        return deptId;
    }


    public void setDeptId(long deptId) {
        this.deptId = deptId;
    }


    public String getDeptName() {
        return deptName;
    }


    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }


//    public List<Employee> getOwnEmployeeList() {
//        return ownEmployeeList;
//    }
//
//    public void setOwnEmployeeList(List<Employee> ownEmployeeList) {
//        this.ownEmployeeList = ownEmployeeList;
//    }

    @Override
    public String toString() {
	return "Department [deptId=" + deptId + ", deptName=" + deptName + "]";
    }
    
    
}
